package cn.hxh.page.service.impl;

import cn.hxh.page.mapper.UserMapper;
import cn.hxh.page.pojo.User;
import cn.hxh.page.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.UUID;

/**
 * @Author: HongXiaoHan
 * @Description
 * @Date: 2020/10/5 21:02
 */
@Component
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User login(String password,String account) {
        return userMapper.login(password,account);
    }

    @Override
    public List<User> query() {
        return null;
    }

    @Override
    public int register(String password, String account) {
        int i = userMapper.register(UUID.randomUUID().toString().replaceAll("-",""),password,account);
        if (i > 0){
            return 1;
        }
        return 0;
    }
}
